Skip to content

Conversation

Copy link

Copilot AI commented Nov 6, 2025

M5Stack CoreS3 has dual MEMS microphones connected via ES7210 4-channel ADC. This PR implements ES7210 initialization and I2S configuration based on M5Unified to enable embedded:io/audio/in.

Changes

New ES7210 driver (modules/drivers/peripherals/es7210/)

  • I2C initialization sequence at 0x40 matching M5Unified register configuration
  • Microphone gain, bias, and filter setup
  • Error handling for missing hardware

M5Stack CoreS3 target updates

  • manifest.json: Add audioin module, configure I2S_NUM_1 stereo @ 16kHz, pins BCK=34/WS=33/DATAIN=14
  • setup-target.js: Initialize ES7210 during target setup

audioin.c enhancement

  • Support stereo I2S mode when numChannels=2 (was hardcoded to mono)
  • Use MODDEF_AUDIOIN_I2S_SLOT define for slot mask configuration

Implementation Notes

  • Speaker and mic share I2S bus (different data pins: 13/14)
  • Standard I2S mode, not PDM
  • Stereo captures both onboard microphones

Usage

import AudioIn from "embedded:io/audio/in";

const input = new AudioIn({
    onReadable(size) {
        const samples = new Int16Array(size / 2);
        this.read(samples.buffer);
        // Stereo samples: [L0, R0, L1, R1, ...]
    }
});
input.start();
Original prompt

ModdableSDKでM5Stack CoreS3のマイクが使えるようにしたいです。
https://github.com/m5stack/M5Unified に動作する実装があります。
embedded:ioのI2Sが動作するようにしたいです。電源IC等の初期化処理はbuild/devices/esp32/targets/m5stack_cores3/setup-target.js にありますが、マイクはまだ動作していません。
初期化処理やI2S設定、ESP-IDFの使い方をM5Unifiedと揃えることで動くようになると考えていますが、揃えるべき具体的な差分はまだ把握できていません。


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add support for microphone in M5Stack CoreS3 Enable M5Stack CoreS3 microphone via ES7210 ADC driver Nov 6, 2025
Copilot AI requested a review from meganetaaan November 6, 2025 22:51
Copilot finished work on behalf of meganetaaan November 6, 2025 22:51
"datain": 14,
"pdm": 1
"pdm": 0,
"slot": "(I2S_STD_SLOT_LEFT | I2S_STD_SLOT_RIGHT)"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

使い方が間違っています。configはランタイムの設定です。マクロを設定するにはdefineセクションを使います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants